
#ifndef SerialPort_H
#define SerialPort_H
#pragma   warning   (disable:4786)

//////////////////////////////////////////////////////////////////////////

#include <Windows.h>

//////////////////////////////////////////////////////////////////////////
#include "ComCfg.h"

class CSerialPort
{
private:
	zkComCfg	    m_cfgCom;
	OVERLAPPED		m_OverlappedRead;
	OVERLAPPED		m_OverlappedWrite;

public:
 	bool m_bSet ;
	CSerialPort();
	virtual ~CSerialPort();

	bool	Open(UINT nCom,DWORD  nBaudRate,BYTE nByteSize,BYTE nParity,BYTE nStopBits);
	bool	Set(DWORD  nBaudRate,BYTE nByteSize,BYTE nParity,BYTE nStopBits);
	bool	IsOpen();
	int		Write(char* buffer, DWORD dwLen);
	
	void	Close();

protected:
	HANDLE m_hComm;
};

//////////////////////////////////////////////////////////////////////////

#endif
